package com.spring_mysql_redis.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.spring_mysql_redis.entity.Comment;
import com.spring_mysql_redis.entity.DynamicComm;
import com.spring_mysql_redis.entity.Users;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface CommentMapper extends BaseMapper<Comment> {

    IPage<Comment> selectCommentList(IPage<Comment> page);

    @Select("SELECT c.id,u.icon,u.nickname,c.content,c.create_time FROM sp_comment c LEFT JOIN sp_user u ON c.user_id=u.id  WHERE c.dynamic_id = (#{dynamicId})")
    Page<DynamicComm> getCommentList(Page<DynamicComm> iPage, Integer dynamicId);
}
